<?php
defined('_JEXEC') or die('Restricted access');

?>
<script type="text/javascript">
	jQuery(document).ready(function()
	{
		jQuery("#company_name_check").autocomplete("<?php echo JRoute::_("index.php?option=com_wrd&task=getCompanies", false)?>", {
		    width: 260,
		    matchContains: true,
		    minChars: 1,
		    selectFirst: false
		});
		
		jQuery('#copy_company').click(function(){
			jQuery('#company_name').val(jQuery('#company_name_check').val());
		});
		
		jQuery("#add_company").click(function(){
			jQuery(this).val('Loading...');
			jQuery.ajax({
			  type: "POST",
			  url: "index.php?option=com_wrd&controller=companyname&task=addCompanyAjax",
			  data: {name: jQuery('#company_name').val()}
			}).done(function(msg){
			  jQuery("#add_company").val('Done...').delay('2000').val('Add Company');
			});
		})
	});
</script>



<div class="col width-100">
	<table width="100%">
		<?php if(!empty($this->data->member_id)):?>
		<tr>
			<td class="key">
				<label for="title">Member ID assigned</label>
			</td>
			<td>
				<strong><?php echo $this->data->member_id ; ?></strong>
			</td>
		</tr>
		<?php
		 	endif ;
			if(!empty($this->data->l_name) || !empty($this->data->f_name)):
		?>
		<tr>
			<td class="key">
				<label for="title">Member Name</label>
			</td>
			<td>
				<strong><?php echo $this->data->l_name.' '.$this->data->f_name ; ?></strong>
			</td>
		</tr>
		<?php endif ;?>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['job']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['job_prefix']; ?><?php echo $this->lists['job']; ?>
			</td><td class="key">
				<label for="title"><?php echo $this->configField['department']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['department']; ?>
			</td>
		</tr>
		<tr>
			<td align='right'>
				<div class="key fl_o_job" 
					<?php 
						/*if($this->data->job != 'other'){ 
							echo "style='display:none'" ; 
						} */
					?> >
				<label for="title">Other</label>
				</div>
			</td>
			<td>
				<div class="fl_o_job" 
				<?php 
					/*if($this->data->job != 'other'){ 
						echo "style='display:none'" ; 
					}*/ 
				?>>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->o_job; ?>" id="o_job" name="o_job" class="o_job" />
				</div>
			</td>
			<td>
				<div class="key fl_o_department" 
					<?php 
						if($this->data->department != 'other'){ 
							echo "style='display:none'" ; 
						} 
					?>  align='right'>
					<label for="title">Other</label>
				</div>
			</td>
			<td>
				<div class="fl_o_department" 
					<?php 
						if($this->data->department != 'other'){ 
							echo "style='display:none'" ; 
						} 
					?> >
					<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->o_department ; ?>" id="o_department" name="o_department" class="o_department" />
				</div>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['industry']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['industry']; ?>
			</td><td class="key">
				<label for="title"><?php echo $this->configField['company_name']['caption']; ?></label>
				<label for="title">Company Check</label>
			</td>
			<td>
				<p><input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->company_name; ?>" id="company_name" name="company_name" class="company_name"/><input type="button" id="add_company" name="add_company" value="Add Company" /></p><br>
				<p><input type="text" title="type" maxlength="50" size="40" value="" id="company_name_check" name="company_name_check" class="company_name_check"/><input type="button" id="copy_company" name="copy_company" value="Copy Company" /></p>
			</td>
		</tr>

		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['c_addr']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="500" size="50" value="<?php echo $this->data->c_addr; ?>" id="c_addr" name="c_addr" class="c_addr"/> 
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['c_country']['caption']; ?></label>
			</td>
			<td colspan='3'>
				<?php echo $this->lists['company_country']; ?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['c_city']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['company_city']; ?>
			</td>
			
			
			<td class="key">
				<label for="title"><?php echo $this->configField['c_distric']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['company_distric']; ?>
			</td>
		</tr>
		
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['c_info']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->c_info; ?>" id="c_info" name="c_info" class="c_info" />
			</td>
		</tr>
		<tr>
			<td colspan='4'>
				<a href="javascript:void(null)" onclick="javascript:Joomla.submitbutton('apply')">
					<img title="Save & Next" style="float: right ;" src="<?php echo JURI::base() .'/components/com_wrd/assets/images/save_next.png'?>">
				</a>
			</td>		
		</tr>
	</table>
</div>